package jdbcState;

import org.apache.storm.trident.operation.BaseFunction;
import org.apache.storm.trident.operation.TridentCollector;
import org.apache.storm.trident.tuple.TridentTuple;
import org.apache.storm.tuple.Values;

/**
 * 将收到的tuple中唯一的字段【tels】，按照tab进行拆分，并将拆分后的2个字段（tel,money)追加到现有tuple的末尾
 */
class KeyValueFun extends BaseFunction {
    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        String record = tuple.getString(0);

        collector.emit(new Values(
                                    record.split("\t")[0],
                                    record.split("\t")[1]
                                )
                    );
    }
}


